﻿using CRM.Infrastructure.Entity;
using CRM.Infrastructure.Service;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace CRM.Op.Controllers
{
    public class PublicController : BaseController
    {
        private CarBrandService brandService = new CarBrandService();
        private CarSerialService serialService = new CarSerialService();
        // GET: Public
        public ActionResult Index()
        {
            return View();
        }
        /// <summary>
        /// 品牌
        /// </summary>
        /// <returns></returns>
        public ContentResult GetBrandList()
        {
            List<CarBrand> list = brandService.QueryAll();
            return ReturnResult(list.Where(m => m.IsActive == 1).OrderBy(m => m.BrandName).ToList());
        }

        /// <summary>
        /// 车型
        /// </summary>
        /// <returns></returns>
        public ContentResult GetSerialList(int brandId)
        {
            List<CarSerial> list = serialService.GetSerialListByBrandId(brandId);
            return ReturnResult(list);
        }
    }
}